package com.baomidou.springwind.service.impl;

import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.mapper.Wrapper;
import com.baomidou.springwind.entity.ReceiveGoods;
import com.baomidou.springwind.mapper.ReceiveGoodsDao;
import com.baomidou.springwind.service.ReceiveGoodsService;
import com.baomidou.springwind.service.support.BaseServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

/**
 * ReceiveGoods 表数据服务层接口实现类
 */
@Service
public class ReceiveGoodsServiceImpl extends BaseServiceImpl<ReceiveGoodsDao, ReceiveGoods> implements ReceiveGoodsService {

    @Autowired
    private ReceiveGoodsDao receiveGoodsDao;

    @Override
    public List<Map<String, Object>> getReceiveGoodsList(Long batchId) {
        Wrapper<ReceiveGoods> wrapper = new EntityWrapper<ReceiveGoods>();
        wrapper.setSqlSelect("arrival_time time,amount");
        wrapper.eq("batch_id", batchId);
        wrapper.eq("operator_id",getCurrentUserId());
        wrapper.orderBy("arrival_time", true);
        return receiveGoodsDao.selectMaps(wrapper);
    }

    @Override
    public List<Map<String, Object>> selecthourAmount(Long batchId) {
        return receiveGoodsDao.selecthourAmount(batchId);
    }
}